<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>12.3. Dojo View Helpers</title>
<link rel="stylesheet" href="dbstyle.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
<link rel="start" href="index.html" title="Programmer's Reference Guide">
<link rel="up" href="zend.dojo.html" title="Chapter 12. Zend_Dojo">
<link rel="prev" href="zend.dojo.data.html" title="12.2. Zend_Dojo_Data: dojo.data Envelopes">
<link rel="next" href="zend.dojo.form.html" title="12.4. Dojo Form Elements and Decorators">
<link rel="chapter" href="introduction.html" title="Chapter 1. Introduction to Zend Framework">
<link rel="chapter" href="zend.acl.html" title="Chapter 2. Zend_Acl">
<link rel="chapter" href="zend.auth.html" title="Chapter 3. Zend_Auth">
<link rel="chapter" href="zend.cache.html" title="Chapter 4. Zend_Cache">
<link rel="chapter" href="zend.config.html" title="Chapter 5. Zend_Config">
<link rel="chapter" href="zend.console.getopt.html" title="Chapter 6. Zend_Console_Getopt">
<link rel="chapter" href="zend.controller.html" title="Chapter 7. Zend_Controller">
<link rel="chapter" href="zend.currency.html" title="Chapter 8. Zend_Currency">
<link rel="chapter" href="zend.date.html" title="Chapter 9. Zend_Date">
<link rel="chapter" href="zend.db.html" title="Chapter 10. Zend_Db">
<link rel="chapter" href="zend.debug.html" title="Chapter 11. Zend_Debug">
<link rel="chapter" href="zend.dojo.html" title="Chapter 12. Zend_Dojo">
<link rel="chapter" href="zend.dom.html" title="Chapter 13. Zend_Dom">
<link rel="chapter" href="zend.exception.html" title="Chapter 14. Zend_Exception">
<link rel="chapter" href="zend.feed.html" title="Chapter 15. Zend_Feed">
<link rel="chapter" href="zend.filter.html" title="Chapter 16. Zend_Filter">
<link rel="chapter" href="zend.form.html" title="Chapter 17. Zend_Form">
<link rel="chapter" href="zend.gdata.html" title="Chapter 18. Zend_Gdata">
<link rel="chapter" href="zend.http.html" title="Chapter 19. Zend_Http">
<link rel="chapter" href="zend.infocard.html" title="Chapter 20. Zend_InfoCard">
<link rel="chapter" href="zend.json.html" title="Chapter 21. Zend_Json">
<link rel="chapter" href="zend.layout.html" title="Chapter 22. Zend_Layout">
<link rel="chapter" href="zend.ldap.html" title="Chapter 23. Zend_Ldap">
<link rel="chapter" href="zend.loader.html" title="Chapter 24. Zend_Loader">
<link rel="chapter" href="zend.locale.html" title="Chapter 25. Zend_Locale">
<link rel="chapter" href="zend.log.html" title="Chapter 26. Zend_Log">
<link rel="chapter" href="zend.mail.html" title="Chapter 27. Zend_Mail">
<link rel="chapter" href="zend.measure.html" title="Chapter 28. Zend_Measure">
<link rel="chapter" href="zend.memory.html" title="Chapter 29. Zend_Memory">
<link rel="chapter" href="zend.mime.html" title="Chapter 30. Zend_Mime">
<link rel="chapter" href="zend.openid.html" title="Chapter 31. Zend_OpenId">
<link rel="chapter" href="zend.paginator.html" title="Chapter 32. Zend_Paginator">
<link rel="chapter" href="zend.pdf.html" title="Chapter 33. Zend_Pdf">
<link rel="chapter" href="zend.registry.html" title="Chapter 34. Zend_Registry">
<link rel="chapter" href="zend.rest.html" title="Chapter 35. Zend_Rest">
<link rel="chapter" href="zend.search.lucene.html" title="Chapter 36. Zend_Search_Lucene">
<link rel="chapter" href="zend.server.html" title="Chapter 37. Zend_Server">
<link rel="chapter" href="zend.service.html" title="Chapter 38. Zend_Service">
<link rel="chapter" href="zend.session.html" title="Chapter 39. Zend_Session">
<link rel="chapter" href="zend.soap.html" title="Chapter 40. Zend_Soap">
<link rel="chapter" href="zend.test.html" title="Chapter 41. Zend_Test">
<link rel="chapter" href="zend.text.html" title="Chapter 42. Zend_Text">
<link rel="chapter" href="zend.timesync.html" title="Chapter 43. Zend_TimeSync">
<link rel="chapter" href="zend.translate.html" title="Chapter 44. Zend_Translate">
<link rel="chapter" href="zend.uri.html" title="Chapter 45. Zend_Uri">
<link rel="chapter" href="zend.validate.html" title="Chapter 46. Zend_Validate">
<link rel="chapter" href="zend.version.html" title="Chapter 47. Zend_Version">
<link rel="chapter" href="zend.view.html" title="Chapter 48. Zend_View">
<link rel="chapter" href="zend.xmlrpc.html" title="Chapter 49. Zend_XmlRpc">
<link rel="appendix" href="requirements.html" title="Appendix A. Zend Framework Requirements">
<link rel="appendix" href="coding-standard.html" title="Appendix B. Zend Framework Coding Standard for PHP">
<link rel="appendix" href="copyrights.html" title="Appendix C. Copyright Information">
<link rel="index" href="the.index.html" title="Index">
<link rel="subsection" href="zend.dojo.view.html#zend.dojo.view.dojo" title="12.3.1. dojo() View Helper">
<link rel="subsection" href="zend.dojo.view.html#zend.dojo.view.dijit" title="12.3.2. Dijit-Specific View Helpers">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader"><table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">12.3. Dojo View Helpers</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="zend.dojo.data.html">Prev</a> </td>
<th width="60%" align="center">Chapter 12. Zend_Dojo</th>
<td width="20%" align="right"> <a accesskey="n" href="zend.dojo.form.html">Next</a>
</td>
</tr>
</table></div>
<div class="sect1" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="zend.dojo.view"></a>12.3. Dojo View Helpers</h2></div></div></div>
<p>
        Zend Framework provides the following Dojo-specific view helpers:
    </p>
<div class="itemizedlist"><ul type="disc"><li><p>
            <span class="emphasis"><em>dojo():</em></span> setup the Dojo environment
            for your page, including dojo configuration values, custom module
            paths, module require statements, theme stylesheets, whether or not
            to use the CDN, and more.
        </p></li></ul></div>
<div class="example">
<a name="zend.dojo.view.setup"></a><p class="title"><b>Example 12.6. Using Dojo View Helpers</b></p>
<div class="example-contents">
<p>
            To use Dojo view helpers, you will need to tell your view object
            where to find them. You can do this by calling
            <code class="code">addHelperPath()</code>:
        </p>
<pre class="programlisting">
$view-&gt;addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');
</pre>
<p>
            Alternately, you can use <code class="code">Zend_Dojo</code>'s
            <code class="code">enableView()</code> method to do the work for you:
        </p>
<pre class="programlisting">
Zend_Dojo::enableView($view);
</pre>
</div>
</div>
<br class="example-break"><div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.dojo.view.dojo"></a>12.3.1. dojo() View Helper</h3></div></div></div>
<p>
        The <code class="code">dojo()</code> view helper is intended to simplify setting up
        the Dojo environment, including the following responsibilities:
    </p>
<div class="itemizedlist"><ul type="disc">
<li><p>Specifying either a CDN or a local path to a Dojo
                install.</p></li>
<li><p>Specifying paths to custom Dojo modules.</p></li>
<li><p>Specifying dojo.require statements.</p></li>
<li><p>Specifying dijit stylesheet themes to use.</p></li>
<li><p>Specifying dojo.addOnLoad() events.</p></li>
</ul></div>
<p>
        The <code class="code">dojo()</code> view helper implementation is an example of a
        placeholder implementation; the data set in it persists between view
        objects, and may be directly echo'd from your layout script.
    </p>
<div class="example">
<a name="zend.dojo.view.dojo.usage"></a><p class="title"><b>Example 12.7. dojo() View Helper Usage Example</b></p>
<div class="example-contents">
<p>
            For this example, let's assume the developer will be using Dojo from
            a local path; will need to require several dijits; and will be
            utilizing the Tundra dijit theme.
        </p>
<p>
            On many pages, the developer may not utilize Dojo at all. So, we
            will focus on a view script where Dojo is needed, and then on the
            layout script, where we will setup some of the Dojo environment and
            then render it.
        </p>
<p>
            First, we need to tell our view object to use the Dojo view helper
            paths. This can be done in your bootstrap or an early-running
            plugin; simply grab your view object and execute the following:
        </p>
<pre class="programlisting">
$view-&gt;addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');
</pre>
<p>
            Next, the view script. In this case, we're going to specify
            that we will be using a FilteringSelect -- which will consume a
            custom store based on QueryReadStore, which we'll call
            'PairedStore' and store in our 'custom' module.
        </p>
<pre class="programlisting">
&lt;? // setup data store for FilteringSelect ?&gt;
&lt;div dojoType="custom.PairedStore" jsId="stateStore"
    url="/data/autocomplete/type/state/format/ajax" 
    requestMethod="get"&gt;&lt;/div&gt;

&lt;? // Input element: ?&gt;
State: &lt;input id="state" dojoType="dijit.form.FilteringSelect" 
    store="stateStore" pageSize="5" /&gt;

&lt;? // setup required dojo elements:
$this-&gt;dojo()-&gt;enable()
             -&gt;setDjConfigOption('parseOnLoad', true)
             -&gt;registerModulePath('../custom/')
             -&gt;requireModule('dijit.form.FilteringSelect')
             -&gt;requireModule('custom.PairedStore');
</pre>
<p>
            In our layout script, we'll then check to see if Dojo is enabled,
            and, if so, we'll do some more general configuration and assemble
            it:
        </p>
<pre class="programlisting">
&lt;?= $this-&gt;doctype() ?&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;?= $this-&gt;headTitle() ?&gt; 
    &lt;?= $this-&gt;headMeta() ?&gt; 
    &lt;?= $this-&gt;headLink() ?&gt; 
    &lt;?= $this-&gt;headStyle() ?&gt; 
&lt;? if ($this-&gt;dojo()-&gt;isEnabled()):
    $this-&gt;dojo()-&gt;setLocalPath('/js/dojo/dojo.js')
                 -&gt;addStyleSheetModule('dijit.themes.tundra');
    echo $this-&gt;dojo();
?&gt;
    &lt;?= $this-&gt;headScript() ?&gt; 
&lt;/head&gt;
&lt;body class="tundra"&gt;
    &lt;?= $this-&gt;layout()-&gt;content ?&gt;
    &lt;?= $this-&gt;inlineScript() ?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>
            At this point, you only need to ensure that your files are in the
            correct locations and that you've created the end point action for
            your FilteringSelect!
        </p>
</div>
</div>
<br class="example-break"><div class="sect3" lang="en">
<div class="titlepage"><div><div><h4 class="title">
<a name="zend.dojo.view.dojo.declarative"></a>12.3.1.1. Programmatic and Declarative Usage of Dojo</h4></div></div></div>
<p>
            Dojo allows both <span class="emphasis"><em>declarative</em></span> and
            <span class="emphasis"><em>programmatic</em></span> usage of many of its features.
            <span class="emphasis"><em>Declarative</em></span> usage uses standard HTML elements
            with non-standard attributes that are parsed when the page is
            loaded. While this is a powerful and simple syntax to utilize, for
            many developers this can cause issues with page validation.
        </p>
<p>
            <span class="emphasis"><em>Programmatic</em></span> usage allows the developer to
            decorate existing elements by pulling them by ID or CSS selectors
            and passing them to the appropriate object constructors in Dojo.
            Because no non-standard HTML attributes are used, pages continue to
            validate.
        </p>
<p>
            In practice, both use cases allow for graceful degradation when
            javascript is disabled or the various Dojo script resources are
            unreachable. To promote standards and document validation,
            Zend Framework uses programmatic usage by default; the various view
            helpers will generate javascript and push it to the
            <code class="code">dojo()</code> view helper for inclusion when rendered.
        </p>
<p>
            Developers using this technique may also wish to explore the option
            of writing their own programmatic decoration of the page. One
            benefit would be the ability to specify handlers for dijit events.
        </p>
<p>
            To allow this, as well as the ability to use declarative syntax,
            there are a number of static methods available to set this behavior
            globally.
        </p>
<div class="example">
<a name="zend.dojo.view.dojo.declarative.usage"></a><p class="title"><b>Example 12.8. Specifying Declarative and Programmatic Dojo Usage</b></p>
<div class="example-contents">
<p>
                To specify declarative usage, simply call the static
                <code class="code">setUseDeclarative()</code> method:
            </p>
<pre class="programlisting">
Zend_Dojo_View_Helper_Dojo::setUseDeclarative();
</pre>
<p>
                If you decide instead to use programmatic usage, call the static
                <code class="code">setUseProgrammatic()</code> method:
            </p>
<pre class="programlisting">
Zend_Dojo_View_Helper_Dojo::setUseProgrammatic();
</pre>
<p>
                Finally, if you want to create your own programmatic rules, you
                should specify programmatic usage, but pass in the value '-1';
                in this situation, no javascript for decorating any dijits used
                will be created.
            </p>
<pre class="programlisting">
Zend_Dojo_View_Helper_Dojo::setUseProgrammatic(-1);
</pre>
</div>
</div>
<br class="example-break">
</div>
<div class="sect3" lang="en">
<div class="titlepage"><div><div><h4 class="title">
<a name="zend.dojo.view.dojo.themes"></a>12.3.1.2. Themes</h4></div></div></div>
<p>
            Dojo allows the creation of themes for its dijits (widgets). You may
            select one by passing in a module path:
        </p>
<pre class="programlisting">
$view-&gt;dojo()-&gt;addStylesheetModule('dijit.themes.tundra');
</pre>
<p>
            The module path is discovered by using the character '.' as a
            directory separator and using the last value in the list as the name
            of the CSS file in that theme directory to use; in the example
            above, Dojo will look for the theme in
            'dijit/themes/tundra/tundra.css'.
        </p>
<p>
            When using a theme, it is important to remember to pass the theme
            class to, at the least, a container surrounding any dijits you are
            using; the most common use case is to pass it in the body:
        </p>
<pre class="programlisting">
&lt;body class="tundra"&gt;
</pre>
</div>
<div class="sect3" lang="en">
<div class="titlepage"><div><div><h4 class="title">
<a name="zend.dojo.view.dojo.layers"></a>12.3.1.3. Using Layers (Custom Builds)</h4></div></div></div>
<p>
            By default, when you use a dojo.require statement, dojo will make a
            request back to the server to grab the appropriate javascript file.
            If you have many dijits in place, this results in many requests to
            the server -- which is not optimal.
        </p>
<p>
            Dojo's answer to this is to provide the ability to create
            <span class="emphasis"><em>custom builds</em></span>. Builds do several things:
        </p>
<div class="itemizedlist"><ul type="disc">
<li><p>
                Groups required files into <span class="emphasis"><em>layers</em></span>; a layer
                lumps all required files into a single JS file. (Hence the name
                of this section.)
            </p></li>
<li><p>
                "Interns" non-javascript files used by dijits (typically,
                template files). These are also grouped in the same JS file as
                the layer.
            </p></li>
<li><p>
                Passes the file through ShrinkSafe, which strips whitespace and
                comments, as well as shortens variable names.
            </p></li>
</ul></div>
<p>
            Some files can not be layered, but the build process will create a
            special release directory with the layer file and all other files.
            This allows you to have a slimmed-down distribution customized for
            your site or application needs.
        </p>
<p>
            To use a layer, the <code class="code">dojo()</code> view helper has a
            <code class="code">addLayer()</code> method for adding paths to required layers:
        </p>
<pre class="programlisting">
$view-&gt;dojo()-&gt;addLayer('/js/foo/foo.js');
</pre>
<p>
            For more information on creating custom builds, please <a href="http://dojotoolkit.org/book/dojo-book-0-9/part-4-meta-dojo/package-system-and-custom-builds" target="_top">refer
            to the Dojo build documentation</a>.
        </p>
</div>
<div class="sect3" lang="en">
<div class="titlepage"><div><div><h4 class="title">
<a name="zend.dojo.view.dojo.methods"></a>12.3.1.4. Methods Available</h4></div></div></div>
<p>
            The <code class="code">dojo()</code> view helper always returns an instance of
            the dojo placeholder container. That container object has the
            following methods available:
        </p>
<div class="itemizedlist"><ul type="disc">
<li><p><code class="code">setView(Zend_View_Interface $view)</code>: set
                    a view instance in the container.</p></li>
<li><p><code class="code">enable()</code>: explicitly enable Dojo
                    integration.</p></li>
<li><p><code class="code">disable()</code>: disable Dojo
                    integration.</p></li>
<li><p><code class="code">isEnabled()</code>: determine whether or not
                    Dojo integration is enabled.</p></li>
<li><p><code class="code">requireModule($module)</code>: setup a
                    <code class="code">dojo.require</code> statement.</p></li>
<li><p><code class="code">getModules()</code>: determine what modules
                    have been required.</p></li>
<li><p><code class="code">registerModulePath($module, $path)</code>:
                    register a custom Dojo module path.</p></li>
<li><p><code class="code">getModulePaths()</code>: get list of
                    registered module paths.</p></li>
<li><p><code class="code">addLayer($path)</code>: add a layer (custom
                    build) path to use.</p></li>
<li><p><code class="code">addLayer($path)</code>: add a layer (custom
                    build) path to use.</p></li>
<li><p><code class="code">getLayers()</code>: get a list of all
                    registered layer paths (custom builds).</p></li>
<li><p><code class="code">removeLayer($path)</code>: remove the layer
                    that matches <code class="code">$path</code> from the list of registered
                    layers (custom builds).</p></li>
<li><p><code class="code">setCdnBase($url)</code>: set the base URL for
                    a CDN; typically, one of the
                    <code class="code">Zend_Dojo::CDN_BASE_AOL</code> or
                    <code class="code">Zend_Dojo::CDN_BASE_GOOGLE</code>, but it only needs
                    to be the URL string prior to the version number.</p></li>
<li><p><code class="code">getCdnBase()</code>: retrieve the base CDN url
                    to utilize.</p></li>
<li><p><code class="code">setCdnVersion($version = null)</code>: set
                    which version of Dojo to utilize from the CDN.</p></li>
<li><p><code class="code">getCdnVersion()</code>: retrieve what
                    version of Dojo from the CDN will be used.</p></li>
<li><p><code class="code">setCdnDojoPath($path)</code>: set the relative
                    path to the dojo.js or dojo.xd.js file on a CDN; typically,
                    one of the <code class="code">Zend_Dojo::CDN_DOJO_PATH_AOL</code> or
                    <code class="code">Zend_Dojo::CDN_DOJO_PATH_GOOGLE</code>, but it only
                    needs to be the path string following the version
                    number.</p></li>
<li><p><code class="code">getCdnDojoPath()</code>: retrieve the last
                    path segment of the CDN url pointing to the dojo.js
                    file.</p></li>
<li>
<p><code class="code">useCdn()</code></p>: tell the container to
                    utilize the CDN; implicitly enables integration.</li>
<li><p><code class="code">setLocalPath($path)</code>: tell the container
                    the path to a local Dojo install (should be a path relative
                    to the server, and contain the dojo.js file itself);
                    implicitly enables integration.</p></li>
<li><p><code class="code">getLocalPath()</code>: determine what local
                    path to Dojo is being used.</p></li>
<li><p><code class="code">useLocalPath()</code>: is the integration
                    utilizing a Dojo local path?</p></li>
<li><p><code class="code">setDjConfig(array $config)</code>: set
                    dojo/dijit configuration values (expects assoc
                    array).</p></li>
<li><p><code class="code">setDjConfigOption($option, $value)</code>: set
                    a single dojo/dijit configuration value.</p></li>
<li><p><code class="code">getDjConfig()</code>: get all dojo/dijit
                    configuration values.</p></li>
<li><p><code class="code">getDjConfigOption($option, $default =
                    null)</code>: get a single dojo/dijit configuration
                    value.</p></li>
<li><p><code class="code">addStylesheetModule($module)</code>: add a
                    stylesheet based on a module theme.</p></li>
<li><p><code class="code">getStylesheetModules()</code>: get stylesheets
                    registered as module themes.</p></li>
<li><p><code class="code">addStylesheet($path)</code>: add a local
                    stylesheet for use with Dojo.</p></li>
<li><p><code class="code">getStylesheets()</code>: get local Dojo
                    stylesheets.</p></li>
<li><p><code class="code">addOnLoad($spec, $function = null)</code>: add
                    a lambda for dojo.onLoad to call. If one argument is passed,
                    it is assumed to be either a function name or a javascript
                    closure. If two arguments are passed, the first is assumed
                    to be the name of an object instance variable and the second
                    either a method name in that object or a closure to utilize
                    with that object.</p></li>
<li><p><code class="code">getOnLoadActions()</code>: retrieve all
                    dojo.onLoad actions registered with the container. This will
                    be an array of arrays.</p></li>
<li><p><code class="code">onLoadCaptureStart($obj = null)</code>:
                    capture data to be used as a lambda for dojo.onLoad(). If
                    $obj is provided, the captured JS code will be considered a
                    closure to use with that Javascript object.</p></li>
<li><p><code class="code">onLoadCaptureStop($obj = null)</code>: finish
                    capturing data for use with dojo.onLoad().</p></li>
<li><p><code class="code">__toString()</code>: cast the container to a
                    string; renders all HTML style and script elements.</p></li>
</ul></div>
</div>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.dojo.view.dijit"></a>12.3.2. Dijit-Specific View Helpers</h3></div></div></div>
<p>
        To quote the Dojo manual, "Dijit is a widget system layered on top of
        dojo." Dijit includes a variety of layout and form widgets designed to
        provide accessibility features, localization, and standardized (and
        themeable) look-and-feel.
    </p>
<p>
        Zend Framework ships a variety of view helpers that allow you to render
        and utilize dijits within your view scripts. There are three basic
        types:
    </p>
<div class="itemizedlist"><ul type="disc">
<li>
<p>
                <span class="emphasis"><em>Layout Containers</em></span>: these are designed to be
                used within your view scripts or consumed by form decorators
                for forms, sub forms, and display groups. They wrap the various
                classes offerred in dijit.layout. Each dijit layout view helper
                expects the following arguments:
            </p>
<div class="itemizedlist"><ul type="circle">
<li><p>
                        <code class="code">$id</code>: the container name or DOM ID.
                </p></li>
<li><p>
                        <code class="code">$content</code>: the content to wrap in the
                        layout container.
                </p></li>
<li><p>
                        <code class="code">$params</code> (optional): dijit-specific
                        parameters. Basically, any non-HTML attribute that can
                        be used to configure the dijit layout container.
                </p></li>
<li><p>
                        <code class="code">$attribs</code> (optional): any additional HTML
                        attributes that should be used to render the container
                        div. If the key 'id' is passed in this array, it will
                        be used for the form element DOM id, and
                        <code class="code">$id</code> will be used for its name.
                </p></li>
</ul></div>
<p>
                If you pass no arguments to a dijit layout view helper, the
                helper itself will be returned. This allows you to capture
                content, which is often an easier way to pass content to the
                layout container. Examples of this functionality will be shown
                later in this section.
            </p>
</li>
<li>
<p>
                <span class="emphasis"><em>Form Dijit</em></span>: the dijit.form.Form dijit, while
                not completely necessary for use with dijit form elements, will
                ensure that if an attempt is made to submit a form that does
                not validate against client-side validations, submission will
                be halted and validation error messages raised.  The form dijit
                view helper expects the following arguments:
            </p>
<div class="itemizedlist"><ul type="circle">
<li><p>
                        <code class="code">$id</code>: the container name or DOM ID.
                </p></li>
<li><p>
                        <code class="code">$attribs</code> (optional): any additional HTML
                        attributes that should be used to render the container
                        div.
                </p></li>
<li><p>
                        <code class="code">$content</code> (optional): the content to wrap
                        in the form. If none is passed, an empty string will be
                        used.
                </p></li>
</ul></div>
<p>
                The argument order varies from the other dijits in order to
                keep compatibility with the standard <code class="code">form()</code> view
                helper. 
            </p>
</li>
<li>
<p>
                <span class="emphasis"><em>Form Elements</em></span>: these are designed to be
                consumed with <code class="code">Zend_Form</code>, but can be used
                standalone within view scripts as well. Each dijit element view
                helper expects the following arguments:
            </p>
<div class="itemizedlist"><ul type="circle">
<li><p>
                        <code class="code">$id</code>: the element name or DOM ID.
                </p></li>
<li><p>
                        <code class="code">$value</code> (optional): the current value of
                        the element.
                </p></li>
<li><p>
                        <code class="code">$params</code> (optional): dijit-specific
                        parameters. Basically, any non-HTML attribute that can
                        be used to configure a dijit.
                </p></li>
<li><p>
                        <code class="code">$attribs</code> (optional): any additional HTML
                        attributes that should be used to render the dijit. If
                        the key 'id' is passed in this array, it will be used
                        for the form element DOM id, and <code class="code">$id</code> will
                        be used for its name.
                </p></li>
</ul></div>
<p>
                Some elements require more arguments; these will be noted with
                the individual element helper descriptions.
            </p>
</li>
</ul></div>
<p>
        In order to utilize these view helpers, you need to register the path
        to the dojo view helpers with your view object.
    </p>
<div class="example">
<a name="zend.dojo.view.dijit.prefixpath"></a><p class="title"><b>Example 12.9. Registering the Dojo View Helper Prefix Path</b></p>
<div class="example-contents"><pre class="programlisting">
$view-&gt;addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper');
</pre></div>
</div>
<br class="example-break"><div class="sect3" lang="en">
<div class="titlepage"><div><div><h4 class="title">
<a name="zend.dojo.view.dijit.layout"></a>12.3.2.1. Dijit Layout Elements</h4></div></div></div>
<p>
            The dijit.layout family of elements are for creating custom,
            predictable layouts for your site. For any questions on general
            usage, <a href="http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/layout" target="_top">read
            more about them in the Dojo manual</a>. 
        </p>
<p>
            All dijit layout elements have the
            signature <code class="code">string ($id = null, $content = '', array $params =
                array(), array $attribs = array())</code>. In all caess, if you
            pass no arguments, the helper object itself will be returned. This
            gives you access to the <code class="code">captureStart()</code> and
            <code class="code">captureEnd()</code> methods, which allow you to capture
            content instead of passing it to the layout container.
        </p>
<div class="itemizedlist"><ul type="disc">
<li>
<p>
                    <span class="emphasis"><em>AccordionContainer</em></span>:
                    dijit.layout.AccordionContainer. Stack all panes together
                    vertically; clicking on a pane titlebar will expand and
                    display that particular pane.
                </p>
<pre class="programlisting">
&lt;?= $view-&gt;accordionContainer(
    'foo', 
    $content, 
    array(
        'duration' =&gt; 200,
    ),
    array(
        'style' =&gt; 'width: 200px; height: 300px;',
    ),
); ?&gt;
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>AccordionPane</em></span>: dijit.layout.AccordionPane.
                    For use within AccordionContainer.
                </p>
<pre class="programlisting">
&lt;?= $view-&gt;accordionPane(
    'foo', 
    $content, 
    array(
        'title' =&gt; 'Pane Title',
    ),
    array(
        'style' =&gt; 'background-color: lightgray;',
    ),
); ?&gt;
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>BorderContainer</em></span>:
                    dijit.layout.BorderContainer. Achieve layouts with
                    optionally resizable panes such as you might see in a
                    traditional application.
                </p>
<pre class="programlisting">
&lt;?= $view-&gt;borderContainer(
    'foo', 
    $content, 
    array(
        'design' =&gt; 'headline',
    ),
    array(
        'style' =&gt; 'width: 100%; height: 100%',
    ),
); ?&gt;
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>ContentPane</em></span>: dijit.layout.ContentPane. Use
                    inside any container except AccordionContainer.
                </p>
<pre class="programlisting">
&lt;?= $view-&gt;contentPane(
    'foo', 
    $content, 
    array(
        'title'  =&gt; 'Pane Title',
        'region' =&gt; 'left',
    ),
    array(
        'style' =&gt; 'width: 120px; background-color: lightgray;',
    ),
); ?&gt;
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>SplitContainer</em></span>:
                    dijit.layout.SplitContainer. Allows resizable content
                    panes; deprecated in Dojo in favor of BorderContainer.
                </p>
<pre class="programlisting">
&lt;?= $view-&gt;splitContainer(
    'foo', 
    $content, 
    array(
        'orientation'  =&gt; 'horizontal',
        'sizerWidth'   =&gt; 7,
        'activeSizing' =&gt; true,
    ),
    array(
        'style' =&gt; 'width: 400px; height: 500px;',
    ),
); ?&gt;
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>StackContainer</em></span>:
                    dijit.layout.StackContainer. All panes within a
                    StackContainer are placed in a stack; build buttons or
                    functionality to reveal one at a time.
                </p>
<pre class="programlisting">
&lt;?= $view-&gt;stackContainer(
    'foo', 
    $content, 
    array(),
    array(
        'style' =&gt; 'width: 400px; height: 500px; border: 1px;',
    ),
); ?&gt;
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>TabContainer</em></span>:
                    dijit.layout.TabContainer. All panes within a
                    TabContainer are placed in a stack, with tabs positioned on
                    one side for switching between them.
                </p>
<pre class="programlisting">
&lt;?= $view-&gt;stackContainer(
    'foo', 
    $content, 
    array(),
    array(
        'style' =&gt; 'width: 400px; height: 500px; border: 1px;',
    ),
); ?&gt;
</pre>
</li>
</ul></div>
<p>
            The following capture methods are available for all layout
            containers:
        </p>
<div class="itemizedlist"><ul type="disc">
<li>
<p>
                    <code class="code">captureStart($id, array $params = array(), array $attribs = array())</code>: 
                    begin capturing content to include in a container.
                    <code class="code">$params</code> refers to the dijit params to use with
                    the container, while <code class="code">$attribs</code> refer to any
                    general HTML attributes to use.
                </p>
<p>
                    Containers may be nested when capturing, <span class="emphasis"><em>so long
                    as no ids are duplicated</em></span>.
                </p>
</li>
<li><p>
                    <code class="code">captureEnd($id)</code>: 
                    finish capturing content to include in a container.
                    <code class="code">$id</code> should refer to an id previously used with
                    a <code class="code">captureStart()</code> call. Returns a string
                    representing the container and its contents, just as if
                    you'd simply passed content to the helper itself.
                </p></li>
</ul></div>
<div class="example">
<a name="zend.dojo.view.dijit.layout.borderexample"></a><p class="title"><b>Example 12.10. BorderContainer layout dijit example</b></p>
<div class="example-contents">
<p>
                BorderContainers, particularly when coupled with the ability to
                capture content, are especially useful for achieving complex
                layout effects.
            </p>
<pre class="programlisting">
$view-&gt;borderContainer()-&gt;captureStart('masterLayout', array('design' =&gt; 'headline'));

echo $view-&gt;contentPane(
    'menuPane',
    'This is the menu pane',
    array('region' =&gt; 'top'),
    array('style' =&gt; 'background-color: darkblue;')
);

echo  $view-&gt;contentPane(
    'navPane',
    'This is the navigation pane',
    array('region' =&gt; 'left'),
    array('style' =&gt; 'width: 200px; background-color: lightblue;')
);

echo $view-&gt;contentPane(
    'mainPane',
    'This is the main content pane area',
    array('region' =&gt; 'center'),
    array('style' =&gt; 'background-color: white;')
);

echo $view-&gt;contentPane(
    'statusPane',
    'Status area',
    array('region' =&gt; 'bottom'),
    array('style' =&gt; 'background-color: lightgray;')
);

echo $view-&gt;borderContainer()-&gt;captureEnd('masterLayout');
</pre>
</div>
</div>
<br class="example-break">
</div>
<div class="sect3" lang="en">
<div class="titlepage"><div><div><h4 class="title">
<a name="zend.dojo.view.dijit.form"></a>12.3.2.2. Dijit Form Elements</h4></div></div></div>
<p>
            Dojo's form validation and input dijits are in the dijit.form tree.
            For more information on general usage of these elements, as well as
            accepted parameters, please <a href="http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/form-validation-specialized-input" target="_top">visit
                the dijit.form documentation</a>.
        </p>
<p>
            The following dijit form elements are available in Zend Framework.
            Except where noted, all have the signature <code class="code">string ($id,
                $value = '', array $params = array(), array $attribs =
                array())</code>.
        </p>
<div class="itemizedlist"><ul type="disc">
<li>
<p>
                    <span class="emphasis"><em>Button</em></span>: dijit.form.Button. Display a
                    form button.
                </p>
<pre class="programlisting">
&lt;?= $view-&gt;button(
    'foo', 
    'Show Me!', 
    array('iconClass' =&gt; 'myButtons'),
); ?&gt;
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>CheckBox</em></span>:
                    dijit.form.CheckBox. Display a checkbox. Accepts an
                    optional fifth argument, the array
                    <code class="code">$checkedOptions</code>, which may contain either:
                </p>
<div class="itemizedlist"><ul type="circle">
<li><p>
                            an indexed array with two values, a checked value
                            and unchecked value, in that order; or
                    </p></li>
<li><p>
                            an associative array with the keys 'checkedValue'
                            and 'unCheckedValue'.
                    </p></li>
</ul></div>
<p>
                    If <code class="code">$checkedOptions</code> is not provided, 1 and 0
                    are assumed.
                </p>
<pre class="programlisting">
&lt;?= $view-&gt;checkBox(
    'foo', 
    'bar', 
    array(),
    array(),
    array('checkedValue' =&gt; 'foo', 'unCheckedValue' =&gt; 'bar')
); ?&gt;
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>ComboBox</em></span>:
                    dijit.layout.ComboBox. ComboBoxes are a hybrid between a
                    select and a text box with autocompletion. The key
                    difference is that you may type an option that is not in
                    the list of available options, and it will still consider
                    it valid input. It accepts an optional fifth argument, an
                    associative array <code class="code">$options</code>; if provided,
                    ComboBox will be rendered as a <code class="code">select</code>. 
                </p>
<p>
                    Alternately, you may pass information regarding a dojo.data
                    datastore to use with the element. If provided, the
                    ComboBox will be rendered as a text <code class="code">input</code>, and
                    will pull its options via that datastore.
                </p>
<p>
                    To specify a datastore, provide one of the following
                    <code class="code">$params</code> key combinations:
                </p>
<div class="itemizedlist"><ul type="circle">
<li>
<p>
                            The key 'store', with an array value; the array
                            should contain the keys:
                        </p>
<div class="itemizedlist"><ul type="square">
<li><p>
                                <span class="emphasis"><em>store</em></span>: the name of the
                                javascript variable representing the datastore
                                (this could be the name you would like for it
                                to use).
                            </p></li>
<li><p>
                                <span class="emphasis"><em>type</em></span>: the datastore type
                                to use; e.g., 'dojo.data.ItemFileReadStore'.
                            </p></li>
<li><p>
                                <span class="emphasis"><em>params</em></span> (optional): an
                                associative array of key/value pairs to use to
                                configure the datastore. The 'url' param is a
                                typical example.
                            </p></li>
</ul></div>
</li>
<li>
<p>
                            The keys:
                        </p>
<div class="itemizedlist"><ul type="square">
<li><p>
                                <span class="emphasis"><em>store</em></span>: a string indicating
                                the datastore name to use.
                            </p></li>
<li><p>
                                <span class="emphasis"><em>storeType</em></span>: a string indicating
                                the datastore dojo.data type to use (e.g.,
                                'dojo.data.ItemFileReadStore').
                            </p></li>
<li><p>
                                <span class="emphasis"><em>storeParams</em></span>: an
                                associative array of key/value pairs with which
                                to configure the datastore.
                            </p></li>
</ul></div>
</li>
</ul></div>
<pre class="programlisting">
// As a select element:
echo $view-&gt;comboBox(
    'foo', 
    'bar', 
    array(
        'autocomplete' =&gt; false,
    ),
    array(),
    array(
        'foo' =&gt; 'Foo',
        'bar' =&gt; 'Bar',
        'baz' =&gt; 'Baz',
    )
);

// As a dojo.data-enabled element:
echo $view-&gt;comboBox(
    'foo', 
    'bar', 
    array(
        'autocomplete' =&gt; false,
        'store'        =&gt; 'stateStore',
        'storeType'    =&gt; 'dojo.data.ItemFileReadStore',
        'storeParams'  =&gt; array('url' =&gt; '/js/states.json'),
    ),
);
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>CurrencyTextBox</em></span>:
                    dijit.form.CurrencyTextBox. Inherits from
                    ValidationTextBox, and provides client-side validation of
                    currency. It expects that the dijit parameter 'currency'
                    will be provided with an appropriate 3-character currency
                    code. You may also specify any dijit parameters valid for
                    ValidationTextBox and TextBox.
                </p>
<pre class="programlisting">
echo $view-&gt;currencyTextBox(
    'foo',
    '$25.00',
    array('currency' =&gt; 'USD'),
    array('maxlength' =&gt; 20)
);
</pre>
<div class="note"><table border="0" summary="Note: Issues with Builds">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Issues with Builds</th>
</tr>
<tr><td align="left" valign="top">
<p>
                        There are currently <a href="http://trac.dojotoolkit.org/ticket/7183" target="_top">known
                        issues with using CurrencyTextBox with build
                        layers</a>. A known work-around is to ensure that
                        your document's Content-Type http-equiv meta tag sets the
                        character set to utf-8, which you can do by calling:
                    </p>
<pre class="programlisting">
$view-&gt;headMeta()-&gt;appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');
?&gt;</pre>
<p>
                        This will mean, of course, that you will need to ensure
                        that the <code class="code">headMeta()</code> placeholder is echoed
                        in your layout script.
                    </p>
</td></tr>
</table></div>
</li>
<li>
<p>
                    <span class="emphasis"><em>DateTextBox</em></span>:
                    dijit.form.DateTextBox. Inherits from
                    ValidationTextBox, and provides both client-side validation of
                    dates, as well as a dropdown calendar from which to select a date.
                    You may specify any dijit parameters available to
                    ValidationTextBox or TextBox.
                </p>
<pre class="programlisting">
echo $view-&gt;dateTextBox(
    'foo',
    '2008-07-11',
    array('required' =&gt; true)
);
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>FilteringSelect</em></span>:
                    dijit.form.FilteringSelect. Similar to ComboBox, this is a
                    select/text hybrid that can either render a provided list
                    of options or those fetched via a dojo.data datastore.
                    Unlike ComboBox, however, FilteringSelect does not allow
                    typing in an option not in its list.
                </p>
<p>
                    Please see the information above on ComboBox for examples
                    and available options for defining datastores.
                </p>
</li>
<li>
<p>
                    <span class="emphasis"><em>HorizontalSlider</em></span> and
                    <span class="emphasis"><em>VerticalSlider</em></span>:
                    dijit.form.HorizontalSlider and dijit.form.VerticalSlider.
                    Sliders allow are UI widgets for selecting numbers in a
                    given range; these are horizontal and vertical variants.
                </p>
<p>
                    At their most basic, they require the dijit parameters
                    'minimum', 'maximum', and 'discreteValues'. These define
                    the range of values. Other common options are:
                </p>
<div class="itemizedlist"><ul type="circle">
<li><p>
                        'intermediateChanges' can be set to indicate whether or not
                        to fire onChange events while the handle is being dragged.
                    </p></li>
<li><p>
                        'clickSelect' can be set to allow clicking a location
                        on the slider to set the value.
                    </p></li>
<li><p>
                        'pageIncrement' can specify the value by which to
                        increase/decrease when pageUp and pageDown are used.
                    </p></li>
<li><p>
                        'showButtons' can be set to allow displaying buttons on
                        either end of the slider for manipulating the value.
                    </p></li>
</ul></div>
<p>
                    The Zend Framework implementation creates a hidden element
                    to store the value of the slider.
                </p>
<p>
                    You may optionally desire to show a rule or labels for the
                    slider. To do so, you will assign one or more of the dijit
                    params 'topDecoration' and/or 'bottomDecoration'
                    (HorizontalSlider) or 'leftDecoration' and/or
                    'rightDecoration' (VerticalSlider). Each of these expects
                    the following options:
                </p>
<div class="itemizedlist"><ul type="circle">
<li><p>
                        <span class="emphasis"><em>container</em></span>: name of the container.
                    </p></li>
<li><p>
                        <span class="emphasis"><em>labels</em></span> (optional): an array of
                        labels to utilize. Use empty strings on either end to
                        provide labels for inner values only. Required when
                        specifying one of the 'Labels' dijit variants.
                    </p></li>
<li><p>
                        <span class="emphasis"><em>dijit</em></span> (optional): one of
                        HorizontalRule, HorizontalRuleLabels, VerticalRule, or
                        VerticalRuleLabels, Defaults to one of the Rule dijits.
                    </p></li>
<li>
<p>
                            <span class="emphasis"><em>params</em></span> (optional): dijit params
                            for configuring the Rule dijit in use. Parameters
                            specific to these dijits include:
                        </p>
<div class="itemizedlist"><ul type="square">
<li><p>
                                <span class="emphasis"><em>container</em></span> (optional):
                                array of parameters and attributes for the rule
                                container.
                            </p></li>
<li><p>
                                <span class="emphasis"><em>labels</em></span> (optional):
                                array of parameters and attributes for the
                                labels list container.
                            </p></li>
</ul></div>
</li>
<li><p>
                        <span class="emphasis"><em>attribs</em></span> (optional): HTML
                        attributes to use with the rules/labels. This should
                        follow the <code class="code">params</code> option format and be an
                        associative array with the keys 'container' and
                        'labels'.
                    </p></li>
</ul></div>
<pre class="programlisting">
echo $view-&gt;horizontalSlider(
    'foo',
    1,
    array(
        'minimum'             =&gt; -10,
        'maximum'             =&gt; 10,
        'discreteValues'      =&gt; 11,
        'intermediateChanges' =&gt; true,
        'showButtons'         =&gt; true,
        'topDecoration'       =&gt; array(
            'container' =&gt; 'topContainer'
            'dijit'     =&gt; 'HorizontalRuleLabels',
            'labels'    =&gt; array(
                ' ',
                '20%',
                '40%',
                '60%',
                '80%',
                ' ',
            ),
            'params' =&gt; array(
                'container' =&gt; array(
                    'style' =&gt; 'height:1.2em; font-size=75%;color:gray;',
                ),
                'labels' =&gt; array(
                    'style' =&gt; 'height:1em; font-size=75%;color:gray;',
                ),
            ),
        ),
        'bottomDecoration'    =&gt; array(
            'container' =&gt; 'bottomContainer'
            'labels'    =&gt; array(
                '0%',
                '50%',
                '100%',
            ),
            'params' =&gt; array(
                'container' =&gt; array(
                    'style' =&gt; 'height:1.2em; font-size=75%;color:gray;',
                ),
                'labels' =&gt; array(
                    'style' =&gt; 'height:1em; font-size=75%;color:gray;',
                ),
            ),
        ),
    )
);
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>NumberSpinner</em></span>:
                    dijit.form.NumberSpinner. Text box for numeric entry, with
                    buttons for incrementing and decrementing.
                </p>
<p>
                    Expects either an associative array for the dijit parameter
                    'constraints', or simply the keys 'min', 'max', and
                    'places' (these would be the expected entries of the
                    constraints parameter as well). 'places' can be used to
                    indicate how much the number spinner will increment and
                    decrement.
                </p>
<pre class="programlisting">
echo $view-&gt;numberSpinner(
    'foo',
    5,
    array(
        'min'    =&gt; -10,
        'max'    =&gt; 10,
        'places' =&gt; 2,
    ),
    array(
        'maxlenth' =&gt; 3,
    )
);
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>NumberTextBox</em></span>:
                    dijit.form.NumberTextBox. NumberTextBox provides the
                    ability to format and display number entries in a localized
                    fashion, as well as validate numerical entries, optionally
                    against given constraints. 
                </p>
<pre class="programlisting">
echo $view-&gt;numberTextBox(
    'foo',
    5,
    array(
        'places' =&gt; 4,
        'type'   =&gt; 'percent',
    ),
    array(
        'maxlength' =&gt; 20,
    )
);
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>RadioButton</em></span>: dijit.form.RadioButton. A
                    set of options from which only one may be selected. This
                    behaves in every way like a regular radio, but has a
                    look-and-feel consistent with other dijits.
                </p>
<p>
                    RadioButton accepts an option fourth argument,
                    <code class="code">$options</code>, an associative array of value/label
                    pairs used as the radio options. You may also pass these as
                    the <code class="code">$attribs</code> key <code class="code">options</code>.
                </p>
<pre class="programlisting">
echo $view-&gt;radioButton(
    'foo',
    'bar',
    array(),
    array(),
    array(
        'foo' =&gt; 'Foo',
        'bar' =&gt; 'Bar',
        'baz' =&gt; 'Baz',
    )
);
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>Textarea</em></span>: dijit.form.Textarea. These
                    act like normal textareas, except that instead of having a
                    set number of rows, they expand as the user types. The
                    width should be specified via a style setting.
                </p>
<pre class="programlisting">
echo $view-&gt;textarea(
    'foo',
    'Start writing here...',
    array(),
    array('style' =&gt; 'width: 300px;')
);
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>TextBox</em></span>: dijit.form.TextBox. This
                    element is primarily present to provide a common
                    look-and-feel between various dijit elements, and to
                    provide base functionality for the other TextBox-derived
                    classes (ValidationTextBox, NumberTextBox, CurrencyTextBox,
                    DateTextBox, and TimeTextBox).
                </p>
<p>
                    Common dijit parameter flags include 'lowercase' (cast to
                    lowercase), 'uppercase' (cast to UPPERCASE), 'propercase'
                    (cast to Proper Case), and trim (trim leading and trailing
                    whitespace); all accept boolean values. Additionally, you
                    may specifiy the parameters 'size' and 'maxLength'.
                </p>
<pre class="programlisting">
echo $view-&gt;textBox(
    'foo',
    'some text',
    array(
        'trim'       =&gt; true,
        'propercase' =&gt; true,
        'maxLength'  =&gt; 20,
    ),
    array(
        'size' =&gt; 20,
    )
);
</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>TimeTextBox</em></span>: dijit.form.TimeTextBox.
                    Also in the TextBox family, TimeTextBox provides a
                    scrollable drop down selection of times from which a user
                    may select. Dijit parameters allow you to specify the time
                    increments available in the select as well as the visible
                    range of times available.
                </p>
<pre class="programlisting">
echo $view-&gt;timeTextBox(
    'foo',
    '',
    array(
        'am.pm'            =&gt; true,
        'visibleIncrement' =&gt; 'T00:05:00', // 5-minute increments
        'visibleRange'     =&gt; 'T02:00:00', // show 2 hours of increments
    ),
    array(
        'size' =&gt; 20,
    )
);

</pre>
</li>
<li>
<p>
                    <span class="emphasis"><em>ValidationTextBox</em></span>:
                    dijit.form.ValidateTextBox. Provide client-side validations
                    for a text element. Inherits from TextBox.
                </p>
<p>
                    Common dijit parameters include:
                </p>
<div class="itemizedlist"><ul type="circle">
<li><p>
                        <span class="emphasis"><em>invalidMessage</em></span>: a message to
                        display when an invalid entry is detected.
                    </p></li>
<li><p>
                        <span class="emphasis"><em>promptMessage</em></span>: a tooltip help
                        message to use.
                    </p></li>
<li><p>
                        <span class="emphasis"><em>regExp</em></span>: a regular expression to
                        use to validate the text. Regular expression does not
                        require boundary markers.
                    </p></li>
<li><p>
                        <span class="emphasis"><em>required</em></span>: whether or not the
                        element is required. If so, and the element is embedded
                        in a dijit.form.Form, it will be flagged as invalid and
                        prevent submission.
                    </p></li>
</ul></div>
<pre class="programlisting">
echo $view-&gt;validationTextBox(
    'foo',
    '',
    array(
        'required' =&gt; true,
        'regExp'   =&gt; '[\w]+',
        'invalidMessage' =&gt; 'No spaces or non-word characters allowed',
        'promptMessage'  =&gt; 'Single word consisting of alphanumeric characters and underscores only',
    ),
    array(
        'maxlength' =&gt; 20,
    )
);
</pre>
</li>
</ul></div>
</div>
</div>
</div>
<div class="navfooter"><table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="zend.dojo.data.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="zend.dojo.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="zend.dojo.form.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">12.2. Zend_Dojo_Data: dojo.data Envelopes </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> 12.4. Dojo Form Elements and Decorators</td>
</tr>
</table></div>
<div class="revinfo"></div>
</body>
</html>
